#!/bin/sh

# Run some Syntax checking tests on PHP and Shell scripts

if [ -x /usr/bin/php ]; then
	for i in `find .. -name *.php`; do
		php -l $i | grep -v "^No syntax errors detected in "
	done

	for i in `grep -rsl "#\!.*php" ..|egrep -v '/\.(svn|git)/'|grep -v \.php`; do
		php -l $i | grep -v "^No syntax errors detected in "
	done
else
	echo "PHP not found in /usr/bin/php"
fi

if [ -x /usr/bin/checkbashisms ]; then
	checkbashisms `grep -rsl "#\!.*/bin/sh" ..|egrep -v '\.(svn|git)/'|egrep -v '^\.\./(config|autom4te)'`
else
	echo "checkbashisms not found in /usr/bin/checkbashisms"
fi
